{extend name="layout/main-block" /}

<!-- main content start -->
{block name="content"}
<section id="main-content">
    <section class="wrapper">
        <div class="row">
            <ol class="breadcrumb">
                <li class="h4"><a href="">图片管理</a></li>
            </ol>
        </div>
        <div class="row col-sm-1" style="margin-bottom: 20px;">
            <a href="{:url('images/img_create')}" class="btn btn-primary" role="button"><i class="glyphicon glyphicon-arrow-up"></i>上传图片</a>
        </div>
        <div class="col-sm-2" style="float: right">
            <a onclick="document.getElementById('mainContent')" id="refresh" class="btn btn-info" role="button"><i class="glyphicon glyphicon-refresh"></i> 刷新</a>
        </div>
        <div class="row content-main">
            <div class="col-sm-12" id="mainContent">
                    <table class="table table-striped">
                        <tr>
                            <th>图片路径</th>
                            <th>图片预览</th>
                        </tr>
                        {volist name="images" id="v" empty="$empty" }
                        <tr>
                            <td><span>{$v.image}</span></td>
                            <td>
                                {if condition="$v neq ''" }
                                <img src="{$v.image}" alt="" width="100">
                                {/if}
                            </td>
                        </tr>
                        {/volist}
                    </table>

                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <li>
                                <a href="?page={$page-1}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            {for start="0" end="$pages"}
                                <li><a href="?page={$i+1}">{$i+1}</a></li>
                            {/for}
                            <li>
                                <a href="?page={$page+1}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                            <li><span>当前第 {$curr_page} 页</span></li>
                        </ul>

                    </nav>

            </div>
        </div>

    </section>
</section>
{/block}

{block name="javascript"}
<script src="http://www.jq22.com/jquery/jquery-migrate-1.2.1.min.js"></script>
<script>
    $(function (){
        $("#refresh").click(function (){
            window.location.reload();
//            var url = "{:url('images/index')}";
//           // var data = "$data_img";
//            $.ajax({
//                type:"get",
//                url:url,
//                //data:data,
//                success:function (refresh){
//                    console.log(refresh);
////                    console.log(111);
////                    $("#mainContent").html(refresh);//要刷新的div
//                }
//            })
        })
    })
</script>
{/block}